// import './assets/main.css'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import "./assets/font/iconfont.css";
import "./assets/scss/index.scss";
import { createApp } from "vue";
import { createPinia } from "pinia";
import ElementPlus from 'element-plus'
import Footer from "@/components/footer/index.vue";
import Exhibition from "@/components/exhibition/index.vue";
import Relics from "@/components/relics-card/index.vue";
import App from "./App.vue";
import router from "./router";
import "@/router/permissions";
import useUserStore from "@/stores/user";
import { getVisitsCount } from "@/api/count";

getVisitsCount().then((res) => {
  const userStore = useUserStore();
  if (!isNaN(+res) && typeof +res === "number") {
    userStore.setCount(res);
  }
}).catch(e => console.log(e, "e"));

const app = createApp(App);
app.config.globalProperties.getImageUrl = function getImageUrl(name) {
  return new URL(`/src/${name}`, import.meta.url).href;
};
app.component("AppFooter", Footer);
app.component("ExhibitionComponent", Exhibition);
app.component("RelicCard", Relics);
app.use(createPinia());
app.use(ElementPlus)
app.use(router);

app.mount("#app");
// import React from 'react';
// import '@chatui/core/es/styles/index.less';
// // 引入组件
// import Chat, { Bubble, useMessages } from '@chatui/core';
// // 引入样式
// import '@chatui/core/dist/index.css';
// app.use(Chat);
// app.use(React);
// app.use(Bubble);
// app.use(useMessages);